﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DAO;

namespace ManageStoreHUHTAMAKI
{
    public partial class DangNhap : Form
    {
        public DangNhap()
        {
            InitializeComponent();
        }

        public string _username = string.Empty;
        public string _pass = string.Empty;
        //ManageStore _manageStore = new ManageStore();
        private void btnDangnhap_Click(object sender, EventArgs e)
        {
            var _nhanvienDAO = new nhanvienDAO();
            var listNhanVien = _nhanvienDAO.GetNhanVien();
            if (listNhanVien != null && listNhanVien.Count > 0)
            {
                string username = txtDangnhap.Text;
                string pass = txtMatkhau.Text;
                foreach (var item in listNhanVien)
                {
                    if (item.tendangnhap.Trim().ToLower() == username.Trim().ToLower() && item.matkhau.Trim().ToLower() == pass.Trim().ToLower())
                    {
                        _username = item.tendangnhap.Trim().ToLower();
                        _pass = item.matkhau.Trim().ToLower();

                        Close();
                    }
                }
            }
        }
    }
}
